﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TasksModel
{
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://mp.tasks.com/2010/", IsNullable = false)]
    public class WebServiceSynchSettings : SynchSettings
    {
        #region Properties

        private string _url;

        /// <summary>
        /// Required.
        /// </summary>
        public string Url
        {
            [System.Diagnostics.DebuggerStepThrough]
            get { return _url; }
            set
            {
                if (!object.ReferenceEquals(_url, value))
                {
                    _url = value;
                    NotifyPropertyChanged("Url");
                }
            }
        }

        #endregion
        
        #region ISynchSettings Members

        public override bool IsConfigured
        {
            get
            {
                return
                    !string.IsNullOrEmpty(Url);
            }
        }

        public override string ProviderName { get { return "Web Service"; } }

        #endregion

        #region Constructors

        public WebServiceSynchSettings(Guid id)
        {
            ID = id;
        }

        public WebServiceSynchSettings()
            : this(Guid.NewGuid())
        {
        }

        /// <summary>
        /// Deep copy. Does not copy events.
        /// </summary>
        public WebServiceSynchSettings(WebServiceSynchSettings ss)
            : this(ss.ID)
        {
            Url = ss.Url;
            Mode = ss.Mode;
            Timestamp = ss.Timestamp;
        }

        #endregion
    }
}